<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2020 the OpenProject GmbH

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.

OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2017 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

See docs/COPYRIGHT.rdoc for more details.

++#%>

<% html_title(l(:label_administration), l(:label_information_plural)) -%>

<%= toolbar title: I18n.t('label_information_plural') %>

<div class="attributes-group">
  <div class="attributes-key-value">
    <%= call_hook(:view_admin_info_top) %>
    <% if (product_version = OpenProject::VERSION.product_version).present? %>
      <div class="attributes-key-value--key"><%= l(:label_product_version) %></div>
      <div class="attributes-key-value--value-container">
        <div class="attributes-key-value--value -text">
          <span><strong><%= product_version %></strong></span>
        </div>
      </div>
    <% end %>
    <div class="attributes-key-value--key"><%= l(:label_core_version) %></div>
    <div class="attributes-key-value--value-container">
      <div class="attributes-key-value--value -text">
        <span><strong><%= OpenProject::Info.versioned_name %></strong> (<%= @db_adapter_name %>)</span>
      </div>
    </div>
    <% if display_security_badge_graphic? %>
      <div class="attributes-key-value--key"></div>
      <div class="attributes-key-value--value-container">
        <div class="attributes-key-value--value -text">
          <div class="security-badge--container">
            <%= content_tag :object, nil, data: security_badge_url, type: "image/svg+xml" %>
            <%= link_to '',
                        ::OpenProject::Static::Links[:security_badge_documentation][:href],
                        title: t(:label_what_is_this),
                        class: 'security-badge--help-icon icon-context icon-help1',
                        target: '_blank' %>
          </div>
        </div>
      </div>
    <% end %>
    <% if (updated_on = OpenProject::VERSION.updated_on).present? %>
      <div class="attributes-key-value--key"><%= l(:label_last_change_on) %></div>
      <div class="attributes-key-value--value-container">
        <div class="attributes-key-value--value -text">
          <span><%= format_date(updated_on) %></span>
        </div>
      </div>
    <% end %>
  </div>
</div>

<%= content_tag :h3, I18n.t('label_system') %>

<div class="attributes-group">
  <div class="attributes-key-value">
    <% @checklist.each do |label, result| %>
      <div class="attributes-key-value--key"><%= l(label) %></div>
      <div class="attributes-key-value--value-container">
        <div class="attributes-key-value--value -text">
          <span><%= icon_wrapper((result ? 'icon-context icon-checkmark' : 'icon-context icon-bug'), (result ? l(:general_text_Yes) : l(:general_text_No))) %></span>
        </div>
      </div>
    <% end %>
  </div>
</div>

<% @storage_information.each_with_index do  |(_,entries), i| %>
<%= content_tag :h3, l(:label_storage_group, identifier: i + 1) %>
<div class="attributes-group">
  <div class="attributes-key-value">
    <div class="attributes-key-value--key"><%= l(:label_storage_for) %></div>
    <div class="attributes-key-value--value-container">
      <div class="attributes-key-value--value -text">
        <span>
          <% entries[:labels].each do |l| %>
            <%= l %>
            <br/>
          <% end %>
        </span>
      </div>
    </div>
    <div class="attributes-key-value--key"><%= l(:label_storage_free_space) %></div>
    <div class="attributes-key-value--value-container">
      <div class="attributes-key-value--value -text">
        <span><%= number_to_human_size(entries[:data][:free], precision: 2) %></span>
      </div>
    </div>
    <div class="attributes-key-value--key"><%= l(:label_storage_used_space) %></div>
    <div class="attributes-key-value--value-container">
      <div class="attributes-key-value--value -text">
        <span>
          <%= number_to_human_size(entries[:data][:used], precision: 2) %>
          (<%= entries[:data][:percent_used].round(2) %> %)
        </span>
      </div>
    </div>
  </div>
</div>
<% end %>

<%= call_hook(:view_admin_info_bottom) %>
